import { useState, useEffect } from 'react'
const App = () => {
  const [count, setCount] = useState(0)
  useEffect(() => {
    console.log(`运行了${count}次`)
  }, [count])
  return (
    <div>
      <h1>计数器:{count}</h1>
      <button onClick={() => setCount(count + 1)}>+1</button>
    </div>
  )
}

export default App
